import { StatusCode } from "@/code";

export interface BaseCallBackParams<T> {
  data: T;
  code: string;
  message: string;
  ok: boolean;
}
export interface EvtEnmu<T> {
  success: BaseCallBackParams<T>;
  fail: BaseCallBackParams<null>;
}

export type BaseOpt<T = null> = {
  [key in keyof EvtEnmu<T>]: (params: EvtEnmu<T>[key]) => void;
};

export interface NetworkInfo {
  mac: string;
  ipv4: string;
}
export interface CamData {
  filename: string;
  file: string;
}
export interface DoubleCamData {
  filenameVl: string;
  fileVl: string;
  filenameIr: string;
  fileIr: string;
  living:
    | "true"   // 活体检测通过;
    | "false"  // 活体检测不通过;
    | "none";  // 未进行活体检测;
}

export interface PinData {
  key: string;
  keyCode: number | null;
}

export interface PrinterColor {
    printerName: string,
    fileType: string,
    fileData: string,
    pageFormat: string,
}

export type GetKeyType<T, K extends keyof T> = {
  [P in keyof T]: T[P];
}[K];

interface WindowOptions {
  width: number;
  height: number;
  x: number;
  y: number;
}

interface PrrData {
  strData: string;
}

interface A4QueneParam {
    strPrinter: string
}

export interface DoubleCamDataOpt {
  mode: "picture" | "checkLiving";
}

export type PrinterQueneParam<T = null> = BaseOpt<T> & A4QueneParam

export type PrintPrrParam<T = null> = BaseOpt<T> & PrrData

export type PrintColorParam<T = number> = BaseOpt<T> & PrinterColor

export type GetHighCameraStreamParam<T = null> = BaseOpt<T> & WindowOptions;

export interface FingerOpt {
  fingerId: string;
}
export interface SaveFingerDataOpt extends BaseFingerDataOpt {
  fingerId: string;
  readCount: number;
}

export interface BaseFingerDataOpt {
  status: StatusCode;
  statusMsg: string;
}